package cn.bitkit.mybatis.constants;

import cn.bitkit.mybatis.base.BaseSqlBuilder;
import cn.bitkit.mybatis.builder.*;
import cn.bitkit.mybatis.builder.*;
import lombok.AllArgsConstructor;

/**
 * @author changbo
 */
@AllArgsConstructor
public enum MapperMethod {
    /**
	 * 查询单个
	 */
	selectById(new SelectByIdBuilder()),
	select(new SelectBuilder()),
	selectList(new SelectListBuilder()),
	selectListByIdList(new SelectListByIdListBuilder()),
	selectCount(new SelectCountBuilder()),
	selectPage(new SelectPageBuilder()),
	selectCursor(new SelectCursorBuilder()),
	selectHandler(new SelectHandlerBuilder()),
	insert(new InsertBuilder()),
	insertList(new InsertListBuilder()),
	deleteById(new DeleteByIdBuilder()),
	deleteByIdList(new DeleteByIdListBuilder()),
	delete(new DeleteBuilder()),
	updateById(new UpdateByIdBuilder()),
	updateNoneNull(new UpdateNonNullBuilder()),
	updateNoneNullById(new UpdateNonNullByIdBuilder()),
	updateNoneNullByIdList(new UpdateNonNullByIdListBuilder()),
	updateGroup(new UpdateGroupBuilder()),
	updateGroupById(new UpdateGroupByIdBuilder()),
	updateGroupByIdList(new UpdateGroupByIdBuilder()),

	;
	public final BaseSqlBuilder builder;

	public static MapperMethod get(String method) {
		for(MapperMethod mapperMethod : MapperMethod.values()) {
			if(mapperMethod.name().equals(method)) {
				return mapperMethod;
			}
		}
		return null;
	}
}
